<form class="form-inline" action="<?=printUrl('Main','adminSubScore')?>" name="subScore" id="subScore">
<div class="table-responsive">
<table border="1" cellspacing="0" style="width: 2200px;" class="table table-hover table-bordered table-condensed">
  <thead>
    <tr>
      <th class="bg-primary text-center" rowspan="2">地区</th>
      <th class="bg-primary text-center" rowspan="2">大区</th>
      <th class="bg-primary text-center" rowspan="2">小区</th>
      <th class="bg-primary text-center" rowspan="2">城市</th>
      <th class="bg-primary text-center" rowspan="2">编码</th>
      <th class="bg-primary text-center" rowspan="2">专营店</th>
      <th class="bg-primary text-center" colspan="5">双月预算明细</th>
      <th class="bg-primary text-center" colspan="19">双月结算明细</th>
    </tr>
    <tr>
      <th class="bg-primary text-center">双月额度</th>
      <th class="bg-primary text-center">上双月结转金额</th>
      <th class="bg-primary text-center">可用额度</th>
      <th class="bg-primary text-center">预算申请金额</th>
      <th class="bg-primary text-center">预算审核金额</th>
      <th class="bg-primary text-center">结算申请金额</th>
      <th class="bg-primary text-center">定额项目可结算总金额</th>
      <th class="bg-primary text-center">天网行动双月额度</th>
      <th class="bg-primary text-center">天网行动可结算金额</th>
      <th class="bg-primary text-center">结算审核金额</th>
      <th class="bg-primary text-center">可结算金额</th>
      <th class="bg-primary text-center">来店目标达成率</th>
      <th class="bg-primary text-center">标准动作完成率</th>
      <th class="bg-primary text-center">活动评分系数</th>
      <th class="bg-primary text-center">结算金额</th>
      <th class="bg-primary text-center">补报预算申请金额</th>
      <th class="bg-primary text-center">补报预算审核金额</th>
      <th class="bg-primary text-center">补报结算申请金额</th>
      <th class="bg-primary text-center">补报结算审核金额</th>
      <th class="bg-primary text-center">补报可结算金额</th>
      <th class="bg-primary text-center">补报扣罚金额</th>
      <th class="bg-primary text-center">补报结算金额</th>
      <th class="bg-primary text-center">最终结算总额</th>
      <th class="bg-primary text-center">结转金额</th>
    </tr>
  </thead>
  <tbody>
    <?php
    foreach ($procList as $k => $v) {
      /*if($v['budgetApply'] == 0){
        continue;
      }*/
    ?>
    <tr>
      <td class="text-center"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['area'] : ''?></td>
      <td class="text-center"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['region'] : ''?></td>
      <td class="text-center"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['spsarea'] : ''?></td>
      <td class="text-center"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['city'] : ''?></td>
      <td class="text-center"><a href="<?=printUrl('SingleBudget','adminList', array('storeId'=>$v['storeId']))?>" target="_blank"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['coding'] : ''?></a></td>
      <td class="text-center"><a href="<?=printUrl('SingleBudget','adminList', array('storeId'=>$v['storeId']))?>" target="_blank"><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['storeName'] : ''?></a></td>
      <td class="text-center"><?=(float)$v['fixedMoney']?></td>
      <td class="text-center"><?=(float)$v['preCarryMoney']?></td>
      <td class="text-center"><?=(float)$v['canUseMoney']?></td>
      <td class="text-center"><?=(float)$v['budgetApply']?></td>
      <td class="text-center"><?=(float)$v['budgetAudit']?></td>
      <td class="text-center"><?=(float)$v['settleApply']?></td>
      <td class="text-center"><?=(float)$v['canSettleMoneyProject']?></td>
      <td class="text-center"><?=(float)$v['budgetApplyNet']?></td>
      <td class="text-center"><?=(float)$v['canSettleMoneyNet']?></td>
      <td class="text-center"><?=(float)$v['settleAudit']?></td>
      <td class="text-center"><?=(float)$v['canSettleMoney']?></td>
      <td class="text-center"><?=(float)$v['storeReach']?>%</td>
      <td class="text-center"><?=(float)$v['standardRate']?>%</td>
      <td class="text-center">
          <?php
          if($subType == 'query' && $this->auth->isSingleSettleSubScore($v) ){
            $btnTitle = (float)$v['score'] == 0 ? '请提交' : '修改评分';
            $v['score'] = (float)$v['score'] == 0 ? '1.0' : $v['score'];
            $maxScore = 0.8;
            if ((float)$v['standardRate'] == 100) {
              $maxScore = 1.2;
            }else{
              $maxScore = 0.8;
            }
          ?>
          <div class="input-group">
            <select class="input-sm" name="subData[<?=$v['id']?>][score]" id="score_<?=$v['id']?>">
              <?php for($i=0.6; $i<=$maxScore; $i+=0.1){ ?>
              <option value="<?=$i?>" <?php echo (string)$i==(string)$v['score'] ? 'selected="selected"' : ''?>><?=$i?></option>
              <?php } ?>
            </select>
              <button class="btn btn-default btn-sm" onclick="ajaxConfirmSubmit('您确定提交此活动评分系数么？','<?=printUrl('Main','adminSubScore')?>',{'fundType':'<?=$fundType?>','subData':{<?=$v['id']?>:{'score':$('#score_<?=$v['id']?>').val()} } })" type="button"><?=$btnTitle?></button>
          </div><!-- /input-group -->
          <?php }else{ echo (float)$v['score'] ? $v['score'] : '未评分'; } ?>
      </td>
      <td class="text-center"><?=(float)$v['settleMoney']?></td>
      <td class="text-center"><?=(float)$v['buBudgetApply']?></td>
      <td class="text-center"><?=(float)$v['buBudgetAudit']?></td>
      <td class="text-center"><?=(float)$v['buSettleApply']?></td>
      <td class="text-center"><?=(float)$v['buSettleAudit']?></td>
      <td class="text-center"><?=(float)$v['buCanSettleMoney']?></td>
      <td class="text-center"><?=(float)$v['buLoseMoney']?></td>
      <td class="text-center"><?=(float)$v['buSettleMoney']?></td>
      <td class="text-center"><?=(float)$v['finalSettleMoney']?></td>
      <td class="text-center"><?=(float)$v['carryMoney']?></td>
    </tr>
    <?php } ?>
    <?php if($subType == 'query' && $this->auth->isSingleSettleSubScore($v)){ ?>
    <tr>
      <td colspan="21" align="right">
          <input type="hidden" name="fundType" id="fundType" value="<?=$fundType?>">
            <button class="btn btn-default btn-sm" type="button" onclick="ajaxFormSubmit('subScore')">批量提交</button>&nbsp;
      </td>
      <td colspan="10"></td>
    </tr>
    <?php } ?>
    <?php
    $total = getArrayColumnTotal($procList,
        array('budgetApply','budgetAudit','fixedMoney','preCarryMoney','canUseMoney','netBudgetApply','canSettleMoneyProject','budgetApplyNet','canSettleMoneyNet','settleApply','settleAudit','canSettleMoney',
            'storeReach','standardRate','score','settleMoney','buBudgetApply','buBudgetAudit','buSettleApply','buSettleAudit',
            'buCanSettleMoney','buLoseMoney','buSettleMoney','finalSettleMoney','carryMoney'),1);
    $count = count($procList);
    ?>
    <tr>
      <td class="text-center" colspan="6">合计</td>
      <td class="text-center"><?=$total['fixedMoney']?></td>
      <td class="text-center"><?=$total['preCarryMoney']?></td>
      <td class="text-center"><?=$total['canUseMoney']?></td>
      <td class="text-center"><?=$total['budgetApply']?></td>
      <td class="text-center"><?=$total['budgetAudit']?></td>
      <td class="text-center"><?=$total['settleApply']?></td>
      <td class="text-center"><?=$total['canSettleMoneyProject']?></td>
      <td class="text-center"><?=$total['budgetApplyNet']?></td>
      <td class="text-center"><?=$total['canSettleMoneyNet']?></td>
      <td class="text-center"><?=$total['settleAudit']?></td>
      <td class="text-center"><?=$total['canSettleMoney']?></td>
      <td class="text-center">
      <?php echo $count ? round((float)$total['storeReach']/$count,2) : 0;?>%
      </td>
      <td class="text-center">
      <?php echo $count ? round((float)$total['standardRate']/$count,2) : 0;?>%
      </td>
      <td class="text-center">
      <?php echo $count ? round((float)$total['score']/$count,2) : 0;?>
      </td>
      <td class="text-center"><?=$total['settleMoney']?></td>
      <td class="text-center"><?=$total['buBudgetApply']?></td>
      <td class="text-center"><?=$total['buBudgetAudit']?></td>
      <td class="text-center"><?=$total['buSettleApply']?></td>
      <td class="text-center"><?=$total['buSettleAudit']?></td>
      <td class="text-center"><?=$total['buCanSettleMoney']?></td>
      <td class="text-center"><?=$total['buLoseMoney']?></td>
      <td class="text-center"><?=$total['buSettleMoney']?></td>
      <td class="text-center"><?=$total['finalSettleMoney']?></td>
      <td class="text-center"><?=$total['carryMoney']?></td>
    </tr>
  </tbody>
</table>
</div>
</form>